//
//  HiSuperController.m
//  HiCar
//
//  Created by 丁一 on 2018/12/12.
//  Copyright © 2018 丁一. All rights reserved.
//

#import "HiSuperController.h"

@interface HiSuperController ()

@end

@implementation HiSuperController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor              = [UIColor whiteColor];
    
    self.navigationItem.leftBarButtonItems = [NSArray arrayWithObjects:[JonesButtonItem PublicBarButtonItemPian], [JonesButtonItem NavImgButton:[UIImage imageNamed:@"back_new"] andaction:@selector(goback) andtarget:self], nil];
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.navigationController.interactivePopGestureRecognizer.delegate = nil;
    }
}

- (void)setnavback{
    UIView *overlay;
    [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
    overlay = [[UIView alloc] initWithFrame:CGRectMake(0, 0, RECERHEIGHT, NAV_Height)];
    overlay.userInteractionEnabled = NO;
    overlay.autoresizingMask = UIViewAutoresizingFlexibleWidth;
    [[self.navigationController.navigationBar.subviews firstObject] insertSubview:overlay atIndex:0];
    overlay.backgroundColor = [UIColor whiteColor];
//    NavgationBJ *navbj=[[NavgationBJ alloc] initWithFrame:CGRectMake(0, 0, RECERHEIGHT, NAV_Height)];
//    [overlay addSubview:navbj];
}

#pragma mark - DZNEmptyDataSetSource
- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView {
    return [UIImage imageNamed:@"error"];
}

- (NSAttributedString *)buttonTitleForEmptyDataSet:(UIScrollView *)scrollView forState:(UIControlState)state {
    NSString *text = @"无数据?点击加载";
    NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc] initWithString:text];
    [attStr addAttribute:NSFontAttributeName
                   value:[UIFont systemFontOfSize:14.0]
                   range:NSMakeRange(0, text.length)];
    [attStr addAttribute:NSForegroundColorAttributeName
                   value:[JonesClass stringTOColor:@"#cccccc"]
                   range:NSMakeRange(0, text.length)];
    return attStr;
}

- (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView {
    return 5.0f;
}

#pragma mark - DZNEmptyDataSetDelegate
- (void)emptyDataSet:(UIScrollView *)scrollView didTapButton:(UIButton *)button {
    [self.TableView.mj_header beginRefreshing];
}

-(UITableView *)TableView{
    if (!_TableView) {
        _TableView = [[UITableView alloc] initWithFrame:RECR style:UITableViewStyleGrouped];
        _TableView.dataSource          = self;
        _TableView.delegate            = self;
        _TableView.backgroundColor     = [UIColor whiteColor];
        _TableView.separatorInset      = UIEdgeInsetsMake(0, 15, 0, 0);
        _TableView.separatorStyle      = UITableViewCellSeparatorStyleNone;
        _TableView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
        _TableView.emptyDataSetSource   = self;
        _TableView.emptyDataSetDelegate = self;
    }
    return _TableView;
}

#pragma mark - UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 0;
}

-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    return nil;
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    return nil;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellString = @"cellString";
    UITableViewCell *cell       = [tableView dequeueReusableCellWithIdentifier:cellString];
    if (cell == nil){
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellString];
        cell.accessoryType        = UITableViewCellAccessoryDisclosureIndicator;
        cell.backgroundColor      = [UIColor whiteColor];
        cell.textLabel.font       = [UIFont systemFontOfSize:15];
        cell.detailTextLabel.font = [UIFont systemFontOfSize:15];
    }
    return cell;
}

#pragma mark - UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 45;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return CGFLOAT_MIN;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return CGFLOAT_MIN;
}

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self.view endEditing:YES];
}

-(void)endloading{
    [self.TableView.mj_footer endRefreshing];
    [self.TableView.mj_header endRefreshing];
}

-(void)goback{
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)gobackRoot{
    [self.navigationController popToRootViewControllerAnimated:YES];
}

-(void)Root_Login{
    
}

-(void)reload_view{
    
}

@end
